<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>

    <script>

        // 实现字符串拼接  + 
        //    只要表达式中有字符串 ， 结果就是字符串拼接

        var a = 'a' ;
        var b = 'b' ;
        var c = a + b ;
        console.log(c) ;  // 'ab'


        var m = 1 + '1' ;
        console.log(m) ;   // '11'


        var n = '1' + '1' ;
        console.log(n) ;    // '11'


        console.log(2 + 3 + 'a') ;  // '5a'

        console.log('a' + 2 + 3) ;  //  'a23'


        var x = true + 'hello' ;
        console.log(x) ;  // 'truehello'


        var d ; 
        var e = d + 'hi' ;
        console.log(e) ;  // 'undefinedhi'



    </script>
    
</body>
</html>